<?php
	class hocsinh_lopdb
	{
		public function Add($MaHocSinh,$MaPhanLop)
		{
			$sql = " INSERT INTO `tbl_hocsinh_lop`(`MaHocSinh`, `MaPhanLop`) VALUES ('$MaHocSinh','$MaPhanLop') ";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function Delete($MaHocSinh,$MaPhanLop)
		{
			$sql = "DELETE FROM `tbl_hocsinh_lop` WHERE MaHocSinh = '$MaHocSinh' AND  MaPhanLop = '$MaPhanLop' ";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
	
	
	
		public function GetList($MaHocSinh,$MaPhanLop)
		{
			$sql = " SELECT * FROM `tbl_hocsinh_lop`,`tbl_hocsinh`,`tbl_phanlop`,`tbl_lop`  WHERE tbl_hocsinh_lop.MaPhanLop = tbl_phanlop.MaPhanLop AND tbl_hocsinh.MaHocSinh = tbl_hocsinh_lop.MaHocSinh AND tbl_lop.MaLop = tbl_phanlop.MaLop";
			if($MaHocSinh!="")
				$sql .= " AND tbl_hocsinh_lop.MaHocSinh = '$MaHocSinh' ";
			if($MaPhanLop!="")
				$sql .= " AND tbl_hocsinh_lop.MaPhanLop = '$MaPhanLop' ";
		
			$data = new dataservice();
			return $data->ExecuteQuery($sql);
		}	
	
		
	}
?>